package cn.training.service;

import java.util.List;

import jp.terasoluna.fw.dao.QueryDAO;
import jp.terasoluna.fw.dao.UpdateDAO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.training.bean.UserBean;

@Service
public class HelloWorldService {

	@Autowired
	QueryDAO queryDao;

	@Autowired
	UpdateDAO updateDao;

	
	public UserBean searchUser(UserBean frm) {
	//	UserBean result= queryDao.executeForObject("User.selectUser", frm, UserBean.class);
		frm = queryDao.executeForObject("User.selectUser", frm, UserBean.class);
		//frm.setUserId("test");		
		return frm;
	}
	
	public UserBean searchupUser(UserBean frm) {
		//	UserBean result= queryDao.executeForObject("User.selectUser", frm, UserBean.class);
			frm = queryDao.executeForObject("User.selectupUser", frm, UserBean.class);
			//frm.setUserId("test");		
			return frm;
		}
	
	public List<UserBean> searchallUser(UserBean frm) {
		List<UserBean> result= queryDao.executeForObjectList("User.selectallUser", frm);
		//frm = queryDao.executeForObject("User.selectUser", frm, UserBean.class);
		//frm.setUserId("test");		
		return result;
	}
	
	public int submit(UserBean frm){
		
		return updateDao.execute("User.submitUser",frm);
	}
	
	

	
	public int delete(UserBean frm){
		return updateDao.execute("User.deleteUser",frm);
	}
	
	public int insert(UserBean frm){
		return updateDao.execute("User.insertUser",frm);
	}
	
	public int update(UserBean frm){
		return updateDao.execute("User.updateUser",frm);
	}
	
	
	
}
